package com.hubeiweb.controller;


import com.hubeiweb.pojo.User;
import com.hubeiweb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;


import java.util.ArrayList;
import java.util.List;

@Controller
        public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/user_list.action")
    public String queryUserList(Model model) {
        List<User> list = userService.queryUserList();
        model.addAttribute("userList", list);
        return "user_list";
    }


    @RequestMapping("/add.action")
    public String userAdd(User user) {
         user=new User(1,"管理员","男");
        userService.addUser(user);
        return "user_add";
    }

    }
